Working with Sub Objects
Custom Objects are a special type of table in the Loyalty database, designed to extend the Member Profile with object types specific to the client's business. Custom Objects contain their own unique set of Attributes, and can be used for segmentation, personalization, and analytics. Within a Content Object, the platform allows you to define one or more "child" Sub Objects beneath the "parent' Custom Object.
The Sub Objects section of the Custom Object Details screen allows you to create, view, and manage Sub Objects. As with the "parent" Custom Object, you can define the Attributes that make up each Sub Object.
Note: The platform allows you to create multiple Sub Objects, but they must all be defined at the "child" level. If you need additional levels (such as a "grandchild" level) in your Custom Object table hierarchy, please speak with your Zeta support team for assistance.
A Sub Object is technically an Array-type Attribute within the Custom Object. Arrays allow you to define and store multiple values within the same Attribute. For example, let's say you use a Custom Object to store information about hotel reservations, and you have a Sub Object to store room details. A single reservation (joined up to a Member Profile) could have one or more rooms included as part of the reservation. After defining the Sub Object (and its Attributes) on the Custom Object Details screen, you must add the Sub Object itself as an Array-type Attribute to the Custom Object. Select the Sub Object as the Data Type for this Array-type Attribute.
The JSON for this example is as follows:
{
"id": 9,
"name": "reservations",
"label": "Reservations",
"group": "batch",
"bu_specific": false,
"description": "",
"key": {
"type": "simple",
"fields": [
{
"name": "reservation_id",
"label": "Reservation ID",
"key_index": 1,
"key_code": "bn"
}
]
},
"primary_attributes": [],
"attributes": [
{
"name": "location",
"label": "Location ID",
"type": "String",
"description": "",
"show_in_list": false
},
{
"name": "reservation_id",
"label": "Reservation ID",
"type": "Integer",
"description": "",
"show_in_list": false
},
{
"name": "rooms",
"label": "Rooms",
"type": "List[Object]",
"sub_object": "rooms",
"description": "",
"show_in_list": false
}
],
"sub_objects": [
{
"name": "rooms",
"label": "Rooms",
"description": "",
"attributes": [
{
"name": "room_type",
"label": "Room Type",
"type": "Integer",
"description": "",
"show_in_list": false
},
{
"name": "number_of_guests",
"label": "Number of Guests",
"type": "Integer",
"description": "",
"show_in_list": false
}
]
}
]
}
